/**
 * 象棋游戏页面样式
 */

.chess-game-page {
  padding: 0;
}

.game-card {
  margin: 0;
  border-radius: 8px;
}

.game-layout {
  display: grid;
  grid-template-columns: 300px 1fr 280px;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* 左侧控制面板 */
.game-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 740px; /* 匹配棋盘高度：700px + 40px padding */
}

.control-card {
  height: fit-content;
}

.card-header {
  font-weight: bold;
  color: #2c3e50;
}

.game-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-item {
  display: flex;
  justify-content: space-between;
}

.label {
  color: #666;
  font-size: 14px;
}

.player-red {
  color: #e74c3c;
  font-weight: bold;
}

.player-black {
  color: #2c3e50;
  font-weight: bold;
}

.status, .count {
  color: #2c3e50;
  font-weight: 500;
}

.control-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-buttons .el-button {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
}

.ai-settings {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.setting-label {
  font-size: 14px;
  color: #666;
}

/* 计时器样式 */
.timer-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

.timer-label {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

.timer-value {
  font-size: 16px;
  font-weight: bold;
  color: #2c3e50;
  font-family: 'Courier New', monospace;
}

.timer-warning {
  color: #f39c12 !important;
}

.timer-danger {
  color: #e74c3c !important;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

/* 被吃棋子 */
.captured-pieces {
  flex: 1; /* 填充剩余空间，使底部与棋盘对齐 */
}

.captured-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.captured-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.group-title {
  font-size: 12px;
  color: #666;
  font-weight: 500;
}

.pieces-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.captured-piece {
  display: inline-block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  text-align: center;
  line-height: 32px;
  font-size: 14px;
  font-weight: bold;
  border: 2px solid;
  background: radial-gradient(circle, #fff 0%, #f0f0f0 100%);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  margin: 2px;
  transition: all 0.2s ease;
}

.captured-piece:hover {
  transform: scale(1.1);
}

.captured-piece.piece-red {
  color: #DC143C;
  border-color: #DC143C;
}

.captured-piece.piece-black {
  color: #2F4F4F;
  border-color: #2F4F4F;
}

/* AI设置 */
.ai-settings {
  .setting-item {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    
    .setting-label {
      font-weight: 500;
      color: #606266;
      margin-right: 12px;
      min-width: 80px;
    }
  }
  
  .ai-thinking {
    margin-top: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border-radius: 8px;
    border: 1px solid #e1bee7;
    
    .thinking-text {
      font-size: 13px;
      color: #7b1fa2;
      font-weight: 500;
      animation: thinking 1.5s ease-in-out infinite;
    }
  }
  
  .ai-status {
    margin-top: 8px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
    border-radius: 6px;
    border: 1px solid #c8e6c9;
    
    .status-text {
      font-size: 12px;
      color: #2e7d32;
      font-weight: 500;
    }
  }
}

@keyframes thinking {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}

/* 棋盘区域 */
.board-area {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* 右侧历史记录 */
.history-panel {
  display: flex;
  flex-direction: column;
}

.history-card {
  height: fit-content;
  max-height: 600px;
}

.move-history {
  max-height: 500px;
  overflow-y: auto;
}

.move-item {
  display: flex;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 2px;
}

.move-item:hover {
  background: #f8f9fa;
}

.current-move {
  background: #e3f2fd;
  font-weight: 500;
}

.move-number {
  color: #666;
  font-weight: 500;
  min-width: 20px;
}

.move-text {
  color: #2c3e50;
}

.no-moves {
  text-align: center;
  color: #999;
  font-style: italic;
  padding: 20px;
}

/* 响应式设计 */
@media (max-width: 1400px) {
  .game-layout {
    grid-template-columns: 280px 1fr 260px;
    gap: 16px;
  }
}

@media (max-width: 1200px) {
  .game-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 16px;
    max-width: 800px;
  }
  
  .board-area {
    order: 1;
    margin: 0 auto;
  }
  
  .game-panel {
    order: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    max-width: 600px;
    margin: 0 auto;
  }
  
  .history-panel {
    order: 3;
    max-width: 600px;
    margin: 0 auto;
  }
}

@media (max-width: 768px) {
  .chess-game-page {
    padding: 8px;
  }
  
  .game-layout {
    gap: 12px;
    padding: 12px;
  }
  
  .game-panel {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  // 优化按钮布局
  .control-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  
  // 优化计时器显示
  .timer-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  
  // 优化被吃棋子显示
  .captured-section {
    .captured-group {
      .pieces-list {
        justify-content: center;
      }
    }
  }
}

@media (max-width: 480px) {
  .chess-game-page {
    padding: 4px;
  }
  
  .game-layout {
    padding: 8px;
    gap: 8px;
  }
  
  // 移动端棋盘适配
  .board-area {
    width: 100%;
    overflow-x: auto;
  }
  
  // 小屏幕按钮优化
  .control-buttons {
    grid-template-columns: 1fr;
    gap: 6px;
    
    .el-button {
      font-size: 14px;
      padding: 8px 12px;
    }
  }
  
  // 小屏幕计时器优化
  .timer-item {
    padding: 6px 10px;
    
    .timer-label {
      font-size: 12px;
    }
    
    .timer-value {
      font-size: 14px;
    }
  }
  
  // 历史记录优化
  .move-history {
    max-height: 300px;
  }
  
  .move-item {
    font-size: 13px;
    padding: 3px 6px;
  }
}

